"use strict";
cc._RF.push(module, '2869el1kLRFQYE2VG0q6R9s', 'PureHelper');
// scripts/PureHelper.js

"use strict";

var e = require;
var t = module;
var o = exports;

var _ii,
    nn = void 0 && (void 0).__extends || (_ii = function ii(t, e) {
  return (_ii = Object.setPrototypeOf || {
    __proto__: []
  } instanceof Array && function (t, e) {
    t.__proto__ = e;
  } || function (t, e) {
    for (var o in e) {
      Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
    }
  })(t, e);
}, function (t, e) {
  function o() {
    this.constructor = t;
  }

  _ii(t, e), t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o());
}),
    rr = void 0 && (void 0).__awaiter || function (t, e, o, i) {
  return new (o || (o = Promise))(function (n, a) {
    function r(t) {
      try {
        l(i.next(t));
      } catch (e) {
        a(e);
      }
    }

    function s(t) {
      try {
        l(i["throw"](t));
      } catch (e) {
        a(e);
      }
    }

    function l(t) {
      var e;
      t.done ? n(t.value) : (e = t.value, e instanceof o ? e : new o(function (t) {
        t(e);
      })).then(r, s);
    }

    l((i = i.apply(t, e || [])).next());
  });
};

var oo = void 0 && (void 0).__decorate || function (e, t, a, n) {
  var i,
      o = arguments.length,
      s = o < 3 ? t : null === n ? n = Object.getOwnPropertyDescriptor(t, a) : n;
  if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) s = Reflect.decorate(e, t, a, n);else for (var r = e.length - 1; r >= 0; r--) {
    (i = e[r]) && (s = (o < 3 ? i(s) : o > 3 ? i(t, a, s) : i(t, a)) || s);
  }
  return o > 3 && s && Object.defineProperty(t, a, s), s;
};

Object.defineProperty(o, "__esModule", {
  value: !0
});
var a = cc._decorator,
    n = a.ccclass,
    i = (a.property, function () {
  function e() {}

  var t;
  return t = e, e.getRandomString = function () {
    for (var e = [], o = 0; o < arguments.length; o++) {
      e[o] = arguments[o];
    }

    return e[t.Range(0, e.length)];
  }, e.Range = function (e, t) {
    return Math.floor(Math.random() * (t - e)) + e;
  }, e.moveTowards = function (e, t, o) {
    var a = t.x - e.x,
        n = t.y - e.y,
        i = a * a + n * n;
    if (0 == i || o >= 0 && i <= o * o) return t;
    var r = Math.sqrt(i);
    return cc.v2(e.x + a / r * o, e.y + n / r * o);
  }, e.Distance = function (e, t) {
    var o = e.x - t.x,
        a = e.y - t.y;
    return Math.sqrt(o * o + a * a);
  }, e.Angle_X = function (e, t) {
    return Math.atan2(t.y - e.y, t.x - e.x) * (180 / Math.PI);
  }, e.Angle_Y = function (e, t) {
    return Math.atan2(t.x - e.x, t.y - e.y) * (180 / Math.PI);
  }, e.getTailPosOuter = function (e, t, o) {
    var a = Math.sqrt((e.x - t.x) * (e.x - t.x) + (e.y - t.y) * (e.y - t.y));
    return new cc.Vec2(o * (t.x - e.x) / a + t.x, o * (t.y - e.y) / a + t.y);
  }, e.getPosOuter = function (e, t, o) {
    var a = Math.sqrt((e.x - t.x) * (e.x - t.x) + (e.y - t.y) * (e.y - t.y));
    return new cc.Vec2(o * (t.x - e.x) / a, o * (t.y - e.y) / a);
  }, e.getNowDate = function (e) {
    void 0 === e && (e = !0);
    var t = new Date(),
        o = t.getMonth() + 1,
        a = t.getDate();
    return o <= 9 && (o = "0" + o), a <= 9 && (a = "0" + a), e ? t.getFullYear() + "-" + o + "-" + a + " " + t.getHours() + ":" + t.getMinutes() + ":" + t.getSeconds() : t.getFullYear() + "-" + o + "-" + a;
  }, e.ConTimeUnit = function (e, t) {
    void 0 === t && (t = !1);
    var o = Math.round((e - 1800) / 3600),
        a = Math.round((e - 30) / 60) % 60,
        n = e % 60;
    return 0 == t ? (o > 0 ? o : "00") + (a > 0 ? a >= 10 ? ":" + a : ":0" + a : ":00") + (n > 0 ? n >= 10 ? ":" + n : ":0" + n : ":00") : (o > 0 ? o + "小时" : "") + (a > 0 ? a + "分钟" : "") + (n > 0 ? n + "秒" : "");
  }, e.EventTimes = function (e, t) {
    void 0 === t && (t = void 0);
    var o = Date.parse(new Date().toString());

    if (null == t) {
      var a = cc.sys.localStorage.getItem(e),
          n = null == a || "" == a || null == a ? null : Number(a);
      return null == n ? null : n - o <= 0 ? 0 : (n - o) / 1e3;
    }

    return cc.sys.localStorage.setItem(e, o + 1e3 * t), o + t;
  }, e.GetTimes = function (e) {
    var t = Date.parse(new Date().toString()),
        o = cc.sys.localStorage.getItem(e),
        a = null == o || "" == o || null == o ? null : Number(o);
    return null == a ? null : (a - t) / 1e3;
  }, t = oo([n], e);
}());
o["default"] = i;

cc._RF.pop();